package com.gnerv.battle.boot.module.base.business.impl;

import com.gnerv.battle.boot.common.base.model.RestResult;
import com.gnerv.battle.boot.module.base.business.AuditApiBusiness;
import com.gnerv.battle.boot.module.base.model.dto.AuditApiDTO;
import com.gnerv.battle.boot.module.base.service.AuditApiService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Gnerv LiGen
 */
@Slf4j
@Service
@AllArgsConstructor
public class AuditApiBusinessImpl implements AuditApiBusiness {

    private final AuditApiService auditApiService;

    @Override
    public RestResult<AuditApiDTO> selectByUkId(String ukId) {
        AuditApiDTO auditApiDTO = auditApiService.selectByUkId(ukId);
        return RestResult.ok(auditApiDTO);
    }

    @Override
    public RestResult<List<AuditApiDTO>> listByName(String name, Integer page, Integer size) {
        List<AuditApiDTO> auditApiDTOList = auditApiService.listByName(name, page, size);
        int total = auditApiService.countByName(name);
        return RestResult.ok(auditApiDTOList).page(page, size, total);
    }

}
